define(function(require,exports,module){
	
	
	$("#emailgetForm").validate({
		 rules:{
			 pwd:{
				required: true,
				regexPassword:true
			   },
			 confirmNewPwd: {
				required: true,
				equalTo: "#password"
			   }

		 },
		 messages:{
			 pwd: {
				required: "请输入长度为8到16位的密码，且至少包含英文和数字",
				regexPassword:"密码格式错误"
			  },
			 confirmNewPwd: {
				required: "请输入确认密码",
				equalTo: "两次输入密码不一致"
			 }
		 },
		 showErrors: function(errorMap, errorList) {
		   	this.defaultShowErrors();
		   	$(".normalTips").css("display","none");
		   	$(".errorTips").css("display","none");
		   	if(errorMap.pwd){
		   		$(".errorTips").css("display","block");
		   		$(".errorTips b").html(errorMap.pwd);
		   	}else if(errorMap.confirmNewPwd){
		   		$(".errorTips").css("display","block");
		   		$(".errorTips b").html(errorMap.confirmNewPwd);
		   	}
		   	else{
		   		$(".errorTips").css("display","none");
		   	}
		   },
		errorPlacement:function(error,element){

		},
		
		submitHandler: function(form,event,validator) {      	
	   		$(form).ajaxSubmit({
	   			type:"post",
				dataType:'json',
				success:function(data){
					if(data.result == false){
	    	  			$(".errorTips").css("display","block");
				   		$(".errorTips b").html(data.msg);
		    		}else{
		    			$(".regForm").css("display","none");
		    			$(".successMsg").css("display","block");
		    			$(".regSuccess").html("恭喜您，账户 <em>"+data.msg+"</em> 重置密码成功！");
		    		}
        		}
	        });
		} 
		
		/*submitHandle:function(form){
			form.submit();
		}*/
		
	})
		
	
})

